home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_328.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  740 b   |  7 lines

  1. Objects are required to establish and maintain their own internal coherence. The 'maintaining' part is done by ensuring self-consistency is restored after any operation completes (ex: by incrementing the link count after adding a new link to a linked list).  The part about 'establishing coherence' is the job of a constructor.
  2.  
  3. Constructors are like 'init functions'; they build a valid object.  The constructor turns a pile of incoherent arbitrary bits into a living object. Minimally it initializes any internally used fields that are needed, but it may also allocate resources (memory, files, semaphores, sockets, ...). 
  4.  
  5. A constructor is like a 'factory': it builds objects from dust.
  6.  
  7. 'ctor' is a typical abbreviation for constructor.